package RoomPanel;

import houseHold.Room;
import houseHold.RoomType;

public class PanelBuilder {

	public static RoomPanel newPanel(Room r) {
		RoomPanel newPanel = new RoomPanel();
		newPanel.setRoom(r);
		newPanel.setBounds(r.getOrigin().getX(), r.getOrigin().getY(), r
				.getWidth() / 5, r.getLength() / 5);
		newPanel.setPreferredSize(newPanel.getSize());
		newPanel.setToolTipText(r.getName());
		newPanel.setPanelID(r.getID());
		return newPanel;
	}

	public static RoomPanel newPanel(String type, String name, String width,
			String height, String length, int id) {
		RoomPanel newPanel = new RoomPanel();
		newPanel.getRoom().setName(name);
		newPanel.getRoom().setType(RoomType.select(type));
		newPanel.getRoom().setWidth(Integer.parseInt(width));
		newPanel.getRoom().setHeight(Integer.parseInt(height));
		newPanel.getRoom().setLength(Integer.parseInt(length));
		newPanel.setBounds(1, 1, Integer.parseInt(width) / 5, Integer
				.parseInt(length) / 5);
		newPanel.setPreferredSize(newPanel.getSize());
		newPanel.setPanelID(id);
		newPanel.setToolTipText(newPanel.getRoom().getName());
		return newPanel;
	}
}
